extends BaseBridge

@export var is_special:bool


func _ready() -> void:
	if !is_special:
		var timer = Timer.new()
		timer.wait_time = .5
		timer.autostart = true
		timer.one_shot = true
		add_child(timer)
		timer.timeout.connect(on_time_out)
	else:
		DialogHandler.dialogue_end.connect(die.unbind(1))
	$Sprite2D.material = DissolveShader.duplicate()
	var shape = RectangleShape2D.new()
	shape.size = BRIDGE_SIZE
	collision_shape_2d.shape = shape
	


func on_time_out() -> void:
	die()

func die() -> void:
	super.die()
	Global.player.current_energy += 1
